angular.module('app').config(($stateProvider) => {

    $stateProvider.state('app.action-sheet', {
        url         : '/action-sheet',
        label       : 'Action Sheet',
        controller  : 'app.action-sheet',
        controllerAs: '$ctrl',
        templateUrl : 'view/app/action-sheet/action-sheet.html'
    });
}).controller('app.action-sheet', function ($ionicActionSheet, $timeout) {
    let ctrl = this, hideSheet;
    ctrl.show = ()=> {
        hideSheet = $ionicActionSheet.show({
            buttons            : [
                {text: '<b>Share</b> This'},
                {text: 'Move'}
            ],
            destructiveText    : 'Delete', // 红色的警告按钮名称
            titleText          : 'Modify your album', // 提示消息
            cancelText         : 'Cancel', // 取消按钮名称
            cssClass           : 'custom-class', // 添加自定义 class
            cancelOnStateChange: true, // 路由改变时是否取消 action sheet. 默认 true
            cancel() {
                console.log('cancel');
            },
            destructiveButtonClicked() {
                console.log('destructive');
                return false; // 返回 true 关闭 action sheet, false 不关闭.
            },
            buttonClicked(index) {
                console.log(index);
                return true; // 返回 true 关闭 action sheet, false 不关闭.
            }
        });

        // 5s 后自动关闭(删除dom)
        $timeout(hideSheet, 5000);
    };
});